package br.com.caelum.contato.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import br.com.caelum.mvc.logica.Logica;


public class ControllerServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	public ControllerServlet() {
		super();

	}

	@SuppressWarnings("rawtypes")
	protected void service(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		String parametro = request.getParameter("logica");
		String nomeClasse = "br.com.caelum.mvc.logica." + parametro;

		try {
			Class classe = Class.forName(nomeClasse);
			Logica contatoClient = (Logica) classe
					.newInstance();
			contatoClient.executa(request, response);

		} catch (Exception e) {
			
		}
	}

}
